package main;

import java_cup.runtime.SymbolFactory;
%%
%cup
%class Scanner
%{
	public Scanner(java.io.InputStream r, SymbolFactory sf){
		this(r);
		this.sf=sf;
	}
	private SymbolFactory sf;
%}
%eofval{
    return sf.newSymbol("EOF",sym.EOF);
%eofval}

%%
"FROM" { return sf.newSymbol("From",sym.FROM); }
"OR" { return sf.newSymbol("Or",sym.OR); }
"WHERE" { return sf.newSymbol("Where",sym.WHERE); }
"subSet" { return sf.newSymbol("subSet",sym.SUBSET); }
"SET" { return sf.newSymbol("Set",sym.SET); }
"SORT" { return sf.newSymbol("Sort",sym.SORT); }
"ASC" { return sf.newSymbol("Sort asc",sym.ASC); }
"DESC" { return sf.newSymbol("Sort desc",sym.DESC); }
"AND" { return sf.newSymbol("And",sym.AND); }
"get" { return sf.newSymbol("Get",sym.GET); }
"." { return sf.newSymbol("Dot",sym.DOT); }
">=" { return sf.newSymbol("Greater Equals",sym.GREATEREQUALS); }
"<=" { return sf.newSymbol("Less Equals",sym.LESSEQUALS); }
"==" { return sf.newSymbol("Equals",sym.EQUALS); }
">" { return sf.newSymbol("Greater",sym.GREATER); }
"<" { return sf.newSymbol("Less",sym.LESS); }
"=" { return sf.newSymbol("Assignment",sym.ASSIGNMENT); }
"{" { return sf.newSymbol("Left Bracket",sym.LPAREN); }
"}" { return sf.newSymbol("Right Bracket",sym.RPAREN); }
"(" { return sf.newSymbol("Left Round Bracket",sym.LROUNDPAREN); }
")" { return sf.newSymbol("Right Round Bracket",sym.RROUNDPAREN); }
"," { return sf.newSymbol("Point",sym.POINT); }
[0-9]+ { return sf.newSymbol("Integral Number",sym.NUMBER, new Integer(yytext())); }
[a-zA-Z0-9_]+ { return sf.newSymbol("Text",sym.TEXT, yytext()); }
[ \t\r\n\f] { /* ignore white space. */ }
. { System.err.println("Illegal character: "+yytext()); } 
